package io.renren.modules.user.service.impl;

import io.renren.modules.generator.entity.TTrainingEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.user.dao.TPeopleFireDetachmentDao;
import io.renren.modules.user.entity.TPeopleFireDetachmentEntity;
import io.renren.modules.user.service.TPeopleFireDetachmentService;


@Service("tPeopleFireDetachmentService")
public class TPeopleFireDetachmentServiceImpl extends ServiceImpl<TPeopleFireDetachmentDao, TPeopleFireDetachmentEntity> implements TPeopleFireDetachmentService {

    @Autowired
    private TPeopleFireDetachmentDao tPeopleFireDetachmentDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TPeopleFireDetachmentEntity> page = this.page(
                new Query<TPeopleFireDetachmentEntity>().getPage(params),
                new QueryWrapper<TPeopleFireDetachmentEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<TPeopleFireDetachmentEntity> listDept(String parentId,String squadron) {
        List<TPeopleFireDetachmentEntity> tPeopleFireDetachmentEntities = tPeopleFireDetachmentDao.listDept(parentId,squadron);
        return tPeopleFireDetachmentEntities;
    }


    @Override
    public List<TPeopleFireDetachmentEntity> listZDept(String parentId,String deptId) {
        List<TPeopleFireDetachmentEntity> tPeopleFireDetachmentEntities = tPeopleFireDetachmentDao.listZDept(parentId,deptId);
        return tPeopleFireDetachmentEntities;
    }

    /**
     * 列表
     */
    public PageUtils organizationalStructure(Map<String, Object> params){
        IPage<TPeopleFireDetachmentEntity> page = new Query<TPeopleFireDetachmentEntity>().getPage(params);
        List<TPeopleFireDetachmentEntity> teople = tPeopleFireDetachmentDao.organizationalStructure(params);
        page.setRecords(teople);
        return new PageUtils(page);
    }

}